﻿<UserControl x:Class="QuickMail.View.Controls.MessageControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:businessLogic="clr-namespace:QuickMail.BusinessLogic"
             xmlns:w="clr-namespace:QuickMail.View.Windows"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="800"
             FontSize="14" Foreground="White" Background="#008DB5">
    <Control.Resources>
        <ResourceDictionary Source="../../ResourceDictionary.xaml"/>
    </Control.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal">
            <Button Width="35" Height="35" Command="{x:Static w:MainWindow.BackCommand}" CommandParameter="{Binding}"
                    HorizontalAlignment="Left" Margin="5">
                <Image Source="../../Resources/left_arrow-32.png"></Image>
            </Button>

            <Button x:Name="NextButton" Width="125" Height="35" 
                    Command="{x:Static w:MainWindow.NextMessageCommand}" CommandParameter="{Binding}" 
                    HorizontalAlignment="Left" Margin="5">
                <StackPanel Orientation="Horizontal">
                    <Image Source="../../Resources/down-32.png" Margin="3, 0"/>
                    <TextBlock x:Name="NextTextBlock" FontSize="12" Text="NEXT" VerticalAlignment="Center" Margin="3, 0"/>
                </StackPanel>
            </Button>

            <Button x:Name="PreviousButton" Width="125" Height="35" 
                    Command="{x:Static w:MainWindow.PreviousMessageCommand}" CommandParameter="{Binding}" 
                    HorizontalAlignment="Left" Margin="5">
                <StackPanel Orientation="Horizontal">
                    <Image Source="../../Resources/up-32.png" Margin="3, 0"/>
                    <TextBlock x:Name="PreviousTextBlock" FontSize="12" Text="PREVIOUS" VerticalAlignment="Center" Margin="3, 0"/>
                </StackPanel>
            </Button>

            <Button x:Name="RemoveButton" Width="125" Height="35" 
                    Command="{x:Static w:MainWindow.DeleteMessageCommand}" CommandParameter="{Binding}" 
                    HorizontalAlignment="Left" Margin="5">
                <StackPanel Orientation="Horizontal">
                    <Image Source="../../Resources/trash-32.png" Margin="3, 0"/>
                    <TextBlock x:Name="DeleteTextBlock" FontSize="12" Text="DELETE" VerticalAlignment="Center" Margin="3, 0"/>
                </StackPanel>
            </Button>
        </StackPanel>

        <Button Grid.Row="0" Grid.Column="2" Width="125" Height="35" HorizontalAlignment="Right" Margin="5" Click="OpenFolder_OnClick">
            <StackPanel Orientation="Horizontal">
                <Image Source="../../Resources/opened_folder-32.png" Margin="3, 0"/>
                <TextBlock x:Name="OpenFolderTextBlock" FontSize="12" Text="OPEN FOLDER" VerticalAlignment="Center" Margin="3, 0"/>
            </StackPanel>
        </Button>

        <TextBlock Grid.Row="1" Grid.Column="0" x:Name="FromTitleTextBlock" Text="From:" FontWeight="DemiBold" Margin="5"/>
        <TextBlock Grid.Row="1" Grid.Column="1" x:Name="FromTextBlock" Text="from@mail.com" TextTrimming="WordEllipsis" Margin="5" />
        <TextBlock Grid.Row="1" Grid.Column="2" x:Name="DateTextBlock" Text="21 October 2014" Margin="5"/>

        <TextBlock Grid.Row="2" Grid.Column="0" x:Name="ToTitleTextBlock" Text="To:" FontWeight="DemiBold" Margin="5"/>
        <TextBlock Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" x:Name="ToTextBlock" 
                   TextTrimming="WordEllipsis" Text="to@mail.com" Margin="5"/>

        <!--<TextBlock Grid.Row="2" Grid.Column="0" x:Name="DateTitleTextBlock" Text="Date:" FontWeight="DemiBold" Margin="5"/>-->


        <!--<TextBlock Grid.Row="3" Grid.Column="0" x:Name="SubjectTitleTextBlock" Text="Subject:" FontWeight="DemiBold" Margin="5"/>-->
        <TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" x:Name="SubjectTextBlock" 
                   FontSize="24" FontWeight="DemiBold" TextTrimming="WordEllipsis" Text="My subject" Margin="5"/>

        <WebBrowser Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" x:Name="MessageBrowser"
                    businessLogic:BrowserBehavior.Html="{Binding Path=HtmlText}"/>

        <ScrollViewer Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" Margin="5" 
                      MaxHeight="150" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
            <StackPanel x:Name="AttachmentsWrapPanel" HorizontalAlignment="Left" Orientation="Horizontal"/>
        </ScrollViewer>
    </Grid>
</UserControl>
